package sample.RTTI;

interface HasBatteries {
}

interface Waterproof {
}

interface ShootThings {
}

class Toy {
	Toy() {
	}

	Toy(int i) {
	}
}

class FancyToy extends Toy implements HasBatteries, Waterproof, ShootThings {
	FancyToy() {
		super(1);
	}
}

public class ToyTest {
	public static void main(String[] args) {
		Class c = null;
		try {
			c = Class.forName("sample.RTTI.FancyToy");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

		System.out.println(c);
		Class[] faces = c.getInterfaces();

		for (int i = 0; i < faces.length; i++) {
			System.out.println(faces[i]);
		}

		Class cy = c.getSuperclass();
		Object o = null;

		try {
			o = cy.newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}

		System.out.println(o.getClass());
	}

}
